<template>
    <span class="card">
        <card-dom ref="cardDom" 
        :isShow="cardDomIsShow" 
        :customList="[]" 
        :imgUrl="imgUrl" 
        :userInfoData="userInfoData" 
        :optionWriteList="[]"></card-dom>
    </span>
</template>

<script>
// 自定义方法
import { getCookie } from '_commonFn/cookie.js'

// 自定义组件
import CardDom from "_components/project/common/CardDom"

export default {
    name: 'card',
    props: {
        userInfoData: {
            type: Object,
            default: {},
        }
    },
    data() {
        return {
            imgUrl: '',
            cardDomIsShow: false,
        }
    },
    methods: {
        // 点击查看名片
        clickCheckCard() {
            const myUserId = getCookie('UserId')
            // console.log('this.isMyBusPage', this.isMyBusPage)
            if (this.isMyBusPage) { // 我的业务详情页面
                this.$router.push({
                    path: 'BusCardListSelect',
                    name: 'BusCardListSelect'
                })
            } else { // 显示名片
                this.cardDomIsShow = true
                this.$refs.cardDom.saveCard()
            }
        }
    },
    computed: {
        userInfo() {
            return this.userInfoData
        },
        isMyBusPage() {
            console.log("this.userInfoData", this.userInfoData)
            return getCookie('UserId') === this.userInfo.id
        }
    },
    components: {
        CardDom,
    }
}
</script>

<style lang="scss" scoped>

</style>